package com.example.demo.controller;

import com.example.demo.exceptionmsg.BeaconExcepiton;
import com.example.demo.exceptionmsg.BusinessException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class test {

    @Autowired
    private ObjectMapper objectMapper;

    @GetMapping("/get")
    public String getTest(@Param("type") String type){
        if (type.equals("1")){
            throw new BeaconExcepiton("yichang1");
        }else if (type.equals("2")){
            throw new BusinessException("异常2");
        }else {
            throw new RuntimeException("runtime");
        }
    }

}
